﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 作业1
{
    class Program
    {
        static int max(List<int> data)
        {
            int m = data[0];
            foreach(int n in data)
            {
                if (m<n)
                {
                    m = n;
                }
            }
            return m;
        }
        static int min(List<int> data)
        {
            int m = data[0];
            foreach(int n in data)
            {
                if (m>n)
                {
                    m = n;
                }
            }
            return m;
        }
        static int sum(List<int> data)
        {
            int ans = 0;
            foreach(int n in data)
            {
                ans += n;
            }
            return ans;
        }
        static double average(List<int> data)
        {
            int ans = 0;
            int count = 0;
            foreach(int n in data)
            {
                ans += n;
                count++;
            }
            return ans * 1.0 / count;
        }
        static void Main(string[] args)
        {
            List<int> data = new List<int>();
            Console.WriteLine("输入多少个数字？：");
            int n;
            string input;
            input = Console.ReadLine();
            n = int.Parse(input);
            Console.WriteLine("用空格分开数字");
            input = Console.ReadLine();
            string[] d;
            d = input.Split(' ');
            foreach(string inputing in d)
            {
                int a;
                int.TryParse(inputing, out a);
                data.Add(a);
            }
            Console.WriteLine("最大值为："+ max(data));
            Console.WriteLine("最小值为：" + min(data));
            Console.WriteLine("和为：" + sum(data));
            Console.WriteLine("平均值为：" + average(data));
        }
    }
}
